package com.shph.validation.rule.impl;

import com.shph.validation.Validator;
import com.shph.validation.exception.NotEmptyException;
import com.shph.validation.rule.IRule;

/**
 * 校验值必须是字符串，且为空
 */
public class NotEmptyRule implements IRule<String> {
    @Override
    public boolean test(String value, String refValue) {
        boolean empty = Validator.isEmpty(value);
        if (empty) {
            throw new NotEmptyException();
        }
        return true;
    }
}
